package com.bn.feeds.processor;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.transaction.TransactionManager;

import com.bn.feedMaster.FeedProcessException;
import com.bn.feedMaster.FeedsTools;
import com.bn.feeds.MasterFeedConfiguration;
import com.bn.feeds.tools.FeedRepositoryTool;
import com.bn.feeds.tools.ProductRepositoryTools;
import com.bn.feeds.utils.FeedFileUtils;
import com.bn.feeds.utils.ParseUtils;
import com.bn.feeds.utils.TruParseUtils;

import atg.core.util.StringUtils;
import atg.dtm.TransactionDemarcation;
import atg.dtm.TransactionDemarcationException;
import atg.epub.project.Process;
import atg.nucleus.GenericService;
import atg.repository.Query;
import atg.repository.QueryBuilder;
import atg.repository.QueryExpression;
import atg.repository.Repository;
import atg.repository.RepositoryItem;
import atg.repository.RepositoryView;


/**
 * The Class MasterFeedsProcessor.
 * @author Parveen
 */
public class MasterFeedsProcessor extends GenericService {

    /** The file utils. */
    private FeedFileUtils fileUtils;
    
    /** The parse utils. */
    private ParseUtils parseUtils;
    
    /** The transaction manager. */
    private TransactionManager transactionManager;
    
    /** The price feed processor. */
    private PriceFeedProcessor priceFeedProcessor;
    
    private final static String ERROR_FILE_POST_FIX="_error";
    private String dateFormat;
    /** The feed tools. */
    private FeedsTools feedTools;
    
    private DeltaFeedProcessor deltaFeedprocessor;
    private boolean deltaProcessEnabled;
    
    
    
    /**
	 * Gets the price feed processor.
	 * 
	 * @return the price feed processor
	 */
	public PriceFeedProcessor getPriceFeedProcessor() {
		return priceFeedProcessor;
	}

	/**
	 * Sets the price feed processor.
	 * 
	 * @param priceFeedProcessor
	 *            the new price feed processor
	 */
	public void setPriceFeedProcessor(PriceFeedProcessor priceFeedProcessor) {
		this.priceFeedProcessor = priceFeedProcessor;
	}

    /** The Constant HEADER. */
    private static final String HEADER = "header";
    
    /** The Constant DATA. */
    private static final String DATA = "data";

    /**
	 * Process master feed file.
	 * 
	 * @param configuration
	 *            the configuration
	 * @param feedOutput
	 *            the feed output
	 * @param feedName
	 *            the feed name
	 * @return the string
	 */
    public String processMasterFeedFile(MasterFeedConfiguration configuration, StringBuilder feedOutput, String feedName) {
        if (isLoggingDebug()) {
            logDebug("Entering MasterFeedsProcessor::>processMasterFeedFile()");
        }

        // check if repository or item descriptor or header order is present or
        // not, if not print error and exit
        
        if (configuration.getRepository() == null || StringUtils.isBlank(configuration.getItemDescriptorName())) {
            if (isLoggingError()) {
                logError(new StringBuilder("Invalid Value recieved: repository :: ").append(configuration.getRepository())
                                                                                    .append(",, itemdescriptor :: ")
                                                                                    .append(configuration.getItemDescriptorName())
                                                                                    .append(",, headerOrder with length :: ")
                                                                                    .toString());
            }
            // TO-DO Add to Error Email
            return feedOutput.append(" <div id=\"error\">Invalid Configuration. Not Processing Feed.</div></div>").toString();
        }

        if(deltaProcessEnabled && (feedName.equalsIgnoreCase("sku") || feedName.equalsIgnoreCase("Product"))){

    		
    		boolean currentFileExists = deltaFeedprocessor.isFileExists(configuration.getFilePath());
    		if(!currentFileExists){
    			logInfo("There are no files to process in "+configuration.getFilePath());
    			 return feedOutput.append(" <div id=\"error\">No File Found. Not Processing Feed.</div></div>").toString();
    		}
    		
    		Map<String, List<String[]>> previousDataMap=null;
    		Map<String, List<String[]>> currentDataMap=null;
			try {
				previousDataMap = deltaFeedprocessor.getDataMap(configuration.getProcessedPath(),configuration.getArchiveLocation());
				currentDataMap = deltaFeedprocessor.getDataMap(configuration.getFilePath(),configuration.getProcessedPath());
			} catch (IOException e1) {
				if(isLoggingError()){
					logError("Exception while comparing files"+e1.getMessage());
				}
				return feedOutput.append(" <div id=\"error\">Exception while comparing files"+e1.getMessage()+"</div></div>").toString();
			}
    		
    		
    		
    		
    		if(previousDataMap!=null && currentDataMap!=null)
    		{
    			Map<String, String> currentValues = deltaFeedprocessor.getKeyValues(currentDataMap);
    			Map<String, String> previousValues = deltaFeedprocessor.getKeyValues(previousDataMap);
    			try {
					deltaFeedprocessor.compareMapValues(currentValues,previousValues,currentDataMap,configuration.getFilePath());
				} catch (IOException e) {
					if(isLoggingError()){
						logError("Exception while comparing files"+e.getMessage());
					}
					return feedOutput.append(" <div id=\"error\">Exception while comparing files"+e.getMessage()+"</div></div>").toString();
				}
    		} else {
    			return feedOutput.append(" <div id=\"error\">no Delta records to processes, make sure Process and Processed folder contains files</div></div>").toString();
    		}
    			
    		
    	
        }
        
        // get the feed file object
        //File feedFile = getFileUtils().getFile(configuration.getFilePath(), configuration.getPrefix());
        File[] feedFiles = getFileUtils().getFile(configuration.getFilePath());
        if(feedFiles !=null && feedFiles.length > 0){
        	 for(File feedFile:feedFiles){
        		 if(feedFile.isDirectory()){
        			 continue;
        		 }
            	 // checking, if file is null print error and exit.
                if (feedFile == null) {
                    if (isLoggingError()) {
                        logError(new StringBuilder("File at location: ").append(configuration.getFilePath())
                                                                        .append(", with prefix: ")
                                                                        .append(configuration.getPrefix())
                                                                        .append(" is not found").toString());
                    }
                    return feedOutput.append(" <div id=\"error\">No File Found. Not Processing Feed.</div></div>").toString();
                }

                if(feedName.equalsIgnoreCase("PriceMaster")){
                	getPriceFeedProcessor().process(feedFile,configuration);
                }else{
                    // get then csv data
                	Map<String, List<String[]>> dataMap = null;
                	if(configuration.isNoHeader() && getParseUtils() instanceof TruParseUtils){
                		dataMap = ((TruParseUtils)getParseUtils()).parseFile(feedFile, configuration.getFileType(),configuration.isNoHeader());
                	} else {
                		dataMap = getParseUtils().parseFile(feedFile, configuration.getFileType());	
                	}
                    
                    processData(feedOutput, dataMap, configuration, feedName, feedFile.getName());
                }

                logInfo("File processed and moving to archive location "+feedName);
                if(deltaProcessEnabled && (feedName.equalsIgnoreCase("sku") || feedName.equalsIgnoreCase("Product"))){
                	getFileUtils().archiveFile(configuration.getDeltaArchivePath(), feedFile);
                } else {
                    // archiving file
                    getFileUtils().archiveFile(configuration.getArchiveLocation(), feedFile);
                }
            }
        } else {
        	if(isLoggingDebug()){
        		logDebug("No File Found. Not Processing Feed for "+feedName);	
        	}
        	return feedOutput.append(" <div id=\"error\">No File Found. Not Processing Feed.</div></div>").toString();
        }
       
       
        
        return feedOutput.append("</div>").toString();
        // exiting feedsMasterFile.
    }

    /**
	 * Process data.
	 * 
	 * @param feedOutput
	 *            the feed output
	 * @param dataMap
	 *            the data map
	 * @param configuration
	 *            the configuration
	 * @param feedName
	 *            the feed name
	 */
    private void processData(StringBuilder feedOutput, Map<String, List<String[]>> dataMap,
            MasterFeedConfiguration configuration, String feedName, String feedFileName) {
    	 if(isLoggingDebug()){
				logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData()::>BEGIN:: FeedName:"+feedName.toUpperCase());
			}
        TransactionDemarcation td = null;
        int idColumnIndex;
        StringBuilder errorsBuffer = new StringBuilder();
        Process process = null;
        int totalData = 0;
        int errorCount = 0;
        
        StringBuilder errorIds = new StringBuilder();
        
        TransactionManager tm = getTransactionManager();
        StringBuilder errorItemList =  new StringBuilder();
        boolean wrapperRollback = false;
        try {
            if ((dataMap != null) && (!dataMap.isEmpty())) {
                List<String[]> header = dataMap.get(HEADER);
                if ((header != null) && (!header.isEmpty())) {
                    List<String> mandPropMissngInHeader = feedContainsColumnForMandatoryproperties(header.get(0), configuration);
                    if(mandPropMissngInHeader.isEmpty()){
                    int headerLength = header.get(0).length;
                    idColumnIndex = getIdColumnIndex(header, configuration.getRepositoryIdColumn(),configuration.isUseOOTBId());
                    if(isLoggingDebug()){
        				logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" :: id column index:"+idColumnIndex);
        			}
                    List<String[]> itemList = dataMap.get(DATA);
                    totalData = itemList.size();
                    feedOutput.append("<div id=\"total\"><b>Total Data Recieved :</b>").append(totalData).append(". <br/> </div>");
                    if(isLoggingDebug()){
        				logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" :: Total items to process:"+totalData);
        			}
                    if ((dataMap.get(DATA) != null) && (idColumnIndex >= 0)) {
                        if (isLoggingDebug()) {
                            logDebug(" Feed name: " + feedName+ ". Project Started");
                        }
                        td = new TransactionDemarcation();
                        boolean rollback = false;
                        td.begin(tm, TransactionDemarcation.REQUIRES_NEW);
                        
                        FeedRepositoryTool repositoryTools =  configuration.getRepositoryTools();
                        process = getFeedTools().startProjectInBCC(errorsBuffer, feedName);
                        
                        if (configuration.isTruncateData()){
                            repositoryTools.cleanUpData(configuration.getRepository(), configuration.getItemDescriptorName());
                        }
                        Map<String, String> productProcessedMap = new HashMap<String, String>();
                        Map<String, Integer> mandatoryPropertiesMap = new HashMap<String, Integer>();
                        Map<String, Integer> repositoryPropertiesToTokenIndex = generateRepositoryPropertiesIndex(header.get(0), configuration.getTokenPropertyMap(), mandatoryPropertiesMap, configuration.getMandatoryProperties());
                        Map<String, Integer> repositoryItemPropertiesToTokenIndex = generateRepositoryPropertiesIndex(header.get(0), configuration.getTokenItemPropertyMap(), mandatoryPropertiesMap, configuration.getMandatoryProperties());
                        long count=1;
                        
                        
                        if(repositoryTools instanceof ProductRepositoryTools){
                        	ProductRepositoryTools productRepositoryTools = (ProductRepositoryTools)repositoryTools;
                        	Repository repository = configuration.getPrdRepository();
                        	RepositoryView mediaView = repository.getView("media");
                			QueryBuilder mediaBuilder = mediaView.getQueryBuilder();
                            QueryExpression mediaIdExpression = mediaBuilder.createPropertyQueryExpression("id");
            				QueryExpression mediaExpression = mediaBuilder.createConstantQueryExpression(productRepositoryTools.getProductTemplate());
            				Query mediaQuery = mediaBuilder.createComparisonQuery(mediaIdExpression, mediaExpression, QueryBuilder.EQUALS);
            				RepositoryItem[] media = mediaView.executeQuery(mediaQuery);
            				if(media!=null){
            					productRepositoryTools.setMediaItem(media[0]);	
            				}
            				
                        }
                        
                        // adding csv data in repository.
                        try {
                        	 for (String[] items : itemList) {
                             	logInfo("Processing "+count+" of "+totalData);
                                 String rowItemString =Arrays.toString(items);
                                 if (items.length == headerLength) {
                                 	String repositoryId=null;
                                 	if(configuration.isUseOOTBId()){
                                 		repositoryId="OOTB";
                                 	}else{
                                 		repositoryId=items[idColumnIndex];
                                 	}
                                    
                                     try {
                                     	 if(isLoggingDebug()){
                              				logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" ::Calling addItem for Item with Id:"+repositoryId);
                              			}
                                        List<String> errlst = repositoryTools.processRecord(configuration, items, header.get(0), idColumnIndex,
                                                                      repositoryPropertiesToTokenIndex,  
                                                                      repositoryItemPropertiesToTokenIndex,
                                                                      productProcessedMap,mandatoryPropertiesMap);
                                        if(errlst.size()>0){
                                            if(isLoggingDebug()){
                                                logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" ::Item Added/updated with Id:"+repositoryId+" with errors. To see the errors, enable logDebugging or see in the email");
                                            }
                                            setErrorFromFeedProcessor(errorItemList, errlst);
                                        }else{
                                            if(isLoggingDebug()){
                                                logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" ::Item Added/updated with Id:"+repositoryId);
                                            }
                                        }
                                         
                                     } catch (FeedProcessException e) {
                                     	 logError(e);
                                         setExceptionForProccessRecord(errorItemList, rowItemString, e, feedName, rollback, errorCount, errorIds, idColumnIndex, items, repositoryId);
                                     } catch (Exception e) {
                                     	 logError(e);
                                         setExceptionForProccessRecord(errorItemList, rowItemString, e, feedName, rollback, errorCount, errorIds, idColumnIndex, items, repositoryId);
                                     } finally {
                                        
                                     }

                                 } else {
                                     StringBuilder rItemList = new StringBuilder(":Total Number of elements in row does not match with header length :: Length of header::").append(headerLength).append(" :: Length of Row::").append(items.length).append(rowItemString).append("\n");
                                     setError(errorItemList, rItemList.toString(), null);
                                 	if(isLoggingDebug()){
                         				logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" :: Total Number of elements in row does not match with header length :: Length of header::"+headerLength+" :: Length of Row::"+items.length);
                         			}
                                     errorCount = addItemToString(errorIds, idColumnIndex, errorCount, items);
                                 }
                                 count=count+1;
                             }
                        } catch (Exception e){
                        	logError(e);
                            setExceptionForFeed(errorItemList, feedName, e, rollback, feedOutput);
                        } finally {
                        	try {
                                if (td != null)
                                    td.end(rollback);
                            } catch (TransactionDemarcationException tde) {
                            	 logError(tde);
                                if (isLoggingError()) {
                                    logError(feedName + " :: Exception occcured while Ending transaction", tde);
                                }
                            }
                        }
                       
                        
                        feedOutput.append("<div id=\"success\"><b>Successfully Updated :</b>").append(totalData - errorCount).append(".  </div><br/> ");
                        feedOutput.append("<div id=\"error\"><b>Rows not Processed (Errors) :</b>").append(errorCount).append(". </div><br/> ");
                        feedOutput.append("<div id=\"processed\"><b>Processed Ids for rows having :</b>").append(errorIds.toString()).append(". <br/> </div>");
                        
                        getFeedTools().advanceWorkflow(process, errorsBuffer);
                        // if there is incomplete data items occurred,printing
                        // them.
                        if (isLoggingDebug()) {
                            logDebug(" Feed name " + feedName + ". Project Ended.");
                        }
                    } else {
                        feedOutput.append("<div id=\"error\"> Recieved no data or no Id Column in the feed. </div>");
                        setError(errorItemList, ":Recieved no data or no Id Column in the feed", null);
                        if(isLoggingDebug()){
                            logDebug(feedOutput.toString());
                        }
                    }
                }else{
                        if(isLoggingError()){
                            logError("Mandatory properties are missing in feed file. So not processing whole feed file. Properties missing:"+mandPropMissngInHeader.toString());
                        }
                        setError(errorItemList, "Mandatory properties are missing in feed file. So not processing whole feed file. Properties missing:"+mandPropMissngInHeader.toString(), null);
                        feedOutput.append("Mandatory properties are missing in feed file. So not processing whole feed file. Properties missing:"+mandPropMissngInHeader.toString());
                    }
                } else {
                    feedOutput.append("<div id=\"error\"> Recieved no Header Row in the feed. </div>");
                    setError(errorItemList, ":Recieved no Header Row in the feed", null);
                    if(isLoggingDebug()){
                    	logDebug(feedOutput.toString());
                    }
                }
            }
        } catch (IOException ie) {
        	logError(ie);
            setExceptionForFeed(errorItemList, feedName, ie, wrapperRollback, feedOutput);
        } catch (FeedProcessException fe) {
        	logError(fe);
            setExceptionForFeed(errorItemList, feedName, fe, wrapperRollback, feedOutput);
        } catch (TransactionDemarcationException tde) {
        	logError(tde);
            setExceptionForFeed(errorItemList, feedName, tde, wrapperRollback, feedOutput);
        }  catch (Exception e) {
        	logError(e);
            setExceptionForFeed(errorItemList, feedName, e, wrapperRollback, feedOutput);
        }
        if(isLoggingDebug()){
			logDebug(feedName + " :: MasterFeedsProcessor::>processMasterFeedFile()::>processData()::>END");
		}
        if(errorItemList.length()>0){
            getFileUtils().writeErrorLogToFile(errorItemList, configuration.getErrorDirectoryPath(), feedFileName, ERROR_FILE_POST_FIX);
        }
        
        feedOutput.append(errorItemList.toString());
    }
    
   protected void setExceptionForProccessRecord(StringBuilder errorItemList, String rowItemString, Exception e, String feedName, Boolean rollback, int errorCount, StringBuilder errorIds, int idColumnIndex, String[] items, String repositoryId  ){
       setError(errorItemList, ":Exception while adding Item: "+rowItemString, e);
       if (isLoggingError()) {
           logError(feedName + " :: Exception while adding Item: " + rowItemString, e);
       }
       if(isLoggingDebug()){
           logDebug("MasterFeedsProcessor::>processMasterFeedFile()::>processData():: FeedName:"+feedName.toUpperCase()+" :: An Error occurred while adding Item with Id:"+repositoryId);
       }
       rollback = true;
       errorCount = addItemToString(errorIds, idColumnIndex, errorCount, items);
    }
   
   protected void  setExceptionForFeed(StringBuilder errorItemList, String feedName, Exception e, Boolean wrapperRollback, StringBuilder feedOutput){
       setError(errorItemList, ":Exception while Processing Feed:"+feedName, e);
       if (isLoggingError()) {
           logError("Exception while Processing Feed: " + feedName, e);
       }
       wrapperRollback = true;
       feedOutput.append("<div id=\"error\"> Error occured while Processing Feed. Check Logs for Details. </div>");
   }
    
    protected void setErrorFromFeedProcessor(StringBuilder errorItemList, List<String> errlst ){
        if(errlst.size()>0){
            for(String error : errlst){
                setError(errorItemList, error, null);
            }
        }
    }
    /**
     * Sets the error.
     * 
     * @param errorItemList
     *            the error item list
     * @param error
     *            the error
     * @param e
     *            the e
     */
    protected void setError(StringBuilder errorItemList, String error, Exception e){
        SimpleDateFormat sdf = new SimpleDateFormat(getDateFormat());
        String date = sdf.format(new Date());
        errorItemList.append('[').append(date).append(']').append(error);
        if(e!=null){
            errorItemList.append(" :: Exception -- ").append(e).append(" , message -- ").append(e.getMessage());   
        }
        errorItemList.append("<br /> ");
    }
    
    /**
	 * Adds the item to string.
	 * 
	 * @param errorIds
	 *            the error ids
	 * @param idColumnIndex
	 *            the id column index
	 * @param errorCount
	 *            the error count
	 * @param items
	 *            the items
	 * @return the int
	 */
    protected int addItemToString(StringBuilder errorIds,int idColumnIndex, int errorCount, String[] items){
        if (errorCount > 0 ){
            errorIds.append("&nbsp;&nbsp;,&nbsp;&nbsp;");
        }
        if ((idColumnIndex < items.length) && (idColumnIndex >=0)){
            errorIds.append(items[idColumnIndex]);
            errorCount++;
        }
        
        return errorCount;
        
    }

    protected Map<String, Integer> generateRepositoryPropertiesIndex(String[] header, Map<String, String> propertyMappings, Map<String, Integer> mandatoryPropertiesMap, List<String> mandatoryPropertiesList) {
        // Set<String> propertyMapKeySet = propertyMappings.keySet();
        Map<String, Integer> repositoryPropertiesIndexMap = new HashMap<String, Integer>();
        String prop = null;
        if(propertyMappings!=null && !propertyMappings.isEmpty()){
            //generating the index map for properties
            for (int i = 0; i < header.length; i++) {
                prop=propertyMappings.get(header[i]);
                if(prop!=null){
                    repositoryPropertiesIndexMap.put(prop, i);
                }
            }
            //generating the index map for mandatory properties
            if(!repositoryPropertiesIndexMap.isEmpty()){
                for(String mProp :  mandatoryPropertiesList){
                    if(repositoryPropertiesIndexMap.containsKey(mProp)){
                        mandatoryPropertiesMap.put(mProp, repositoryPropertiesIndexMap.get(mProp));
                    }
                }

            }
        }
        return repositoryPropertiesIndexMap;
    }
    protected List<String> feedContainsColumnForMandatoryproperties(String[] header, MasterFeedConfiguration configuration ){
        List<String> mandatoryPropertiesMissingInHeaderList= new ArrayList<String>();
        if(header!=null && header.length>0 && configuration!=null){
            List<String> mandatoryPropertiesList = configuration.getMandatoryHeaderProperties();
           if(!mandatoryPropertiesList.isEmpty()){
               List<String> headerList = Arrays.asList(header);
                   for(String mandatoryProperty : mandatoryPropertiesList){
                       if(!headerList.contains(mandatoryProperty.toLowerCase())){
                           mandatoryPropertiesMissingInHeaderList.add(mandatoryProperty);
                       }
                   }
           } 
        }
        return mandatoryPropertiesMissingInHeaderList;
    }

    /**
	 * Gets the id column index.
	 * 
	 * @param header
	 *            the header
	 * @param idColumnName
	 *            the id column name
	 * @param useOOTBId
	 *            the use ootb id
	 * @return the id column index
	 */
    public int getIdColumnIndex(List<String[]> header, String idColumnName, boolean useOOTBId) {
        String[] tempheader = header.get(0);
        int returnValue = -1;
        for (int i = 0; i < tempheader.length; i++) {
            if (tempheader[i].equalsIgnoreCase(idColumnName)) {
                returnValue = i;
                break;
            }
        }
        if ((returnValue == -1) && useOOTBId){
            returnValue = tempheader.length + 1;
        } 

        return returnValue;
    }

    /**
	 * Gets the file utils.
	 * 
	 * @return the file utils
	 */
    public FeedFileUtils getFileUtils() {
        return fileUtils;
    }

    /**
	 * Sets the file utils.
	 * 
	 * @param fileUtils
	 *            the new file utils
	 */
    public void setFileUtils(FeedFileUtils fileUtils) {
        this.fileUtils = fileUtils;
    }

    /**
	 * Gets the parses the utils.
	 * 
	 * @return the parses the utils
	 */
    public ParseUtils getParseUtils() {
        return parseUtils;
    }

    /**
	 * Sets the parses the utils.
	 * 
	 * @param parseUtils
	 *            the new parses the utils
	 */
    public void setParseUtils(ParseUtils parseUtils) {
        this.parseUtils = parseUtils;
    }

    /**
	 * Gets the transaction manager.
	 * 
	 * @return the transaction manager
	 */
    public TransactionManager getTransactionManager() {
        return transactionManager;
    }

    /**
	 * Sets the transaction manager.
	 * 
	 * @param pTransactionManager
	 *            the new transaction manager
	 */
    public void setTransactionManager(TransactionManager pTransactionManager) {
        transactionManager = pTransactionManager;
    }

    /**
     * @return the dateFormat
     */
    public String getDateFormat() {
        return dateFormat;
    }

    /**
     * @param dateFormat the dateFormat to set
     */
    public void setDateFormat(String dateFormat) {
        this.dateFormat = dateFormat;
    }

    /**
     * @return the feedTools
     */
    public FeedsTools getFeedTools() {
        return feedTools;
    }

    /**
     * @param feedTools the feedTools to set
     */
    public void setFeedTools(FeedsTools feedTools) {
        this.feedTools = feedTools;
    }

	public DeltaFeedProcessor getDeltaFeedprocessor() {
		return deltaFeedprocessor;
	}

	public void setDeltaFeedprocessor(DeltaFeedProcessor deltaFeedprocessor) {
		this.deltaFeedprocessor = deltaFeedprocessor;
	}

	public boolean isDeltaProcessEnabled() {
		return deltaProcessEnabled;
	}

	public void setDeltaProcessEnabled(boolean deltaProcessEnabled) {
		this.deltaProcessEnabled = deltaProcessEnabled;
	}

}
